* Flags: 
*  #1 - Player has pissed
*  #2 - Bear is going to eat player
*  #3 - Player is dead -- no more messages!
*
* Counters:
*  #1 - On after player pisses.  At 15, tells him to talk to bear.
*  #2 - On at start of game.  At 20, tells him to go read something.
*  #3 - On after player reads graffiti.  At 15, makes clue phone appear.
*  #4 - On when bear sees player.  At 7, the bear eats him.

(* Don't let player do GET ALL, because it doesn't activate all my GET THIS *)
(* and GET THAT commands and I don't want to deal with it.  (Maybe I need   *)
(* to use SPECIAL in the .dat file?)                                        *)
COMMAND GET ALL
BeforeCommand
FlagOFF 3
PrintMessage 48
DoneWithTurn
END_COMMAND

(* Don't let player get anything with the light off. *)
COMMAND GET ANY
BeforeCommand
FlagOFF 3
NOT LightPresent
PrintMessage 49
DoneWithTurn
END_COMMAND

(* Tell player to get posters one at a time. *)
COMMAND GET POSTERS
BeforeCommand
InRoom 207
 OR
InRoom 220
PrintMessage 50
DoneWithTurn
END_COMMAND

(* Turn on counter if player enters room with bear. *)
COMMAND ANY
BeforeCommand
FlagOFF 2
InRoom 300
LightPresent
TurnFlagON 2
TurnCounterON 4
END_COMMAND

(* Have bear eat player if he waits too long. *)
COMMAND ANY
AfterCommand
CounterGT 4 7
PrintMessage 42
TurnFlagON 3
EndGame
QuitAllCMDs
DoneWithTurn
END_COMMAND

(* Bear stops player from leaving. *)
COMMAND SOUTH
BeforeCommand
FlagOFF 3
FlagON 2
PrintMessage 41
DoneWithTurn
END_COMMAND

(* Remind player that bear is going to kill him. *)
COMMAND ANY
AfterCommand
FlagOFF 3
FlagON 2
RandomMessage 43 45
END_COMMAND

(* Turn 'read graffiti' counter on. *)
COMMAND ANY
BeforeCommand
NewLife
TurnCounterON 2
END_COMMAND

(* Tell player to read graffiti. *)
COMMAND ANY
AfterCommand
FlagOFF 3
CounterGT 2 20
PrintMessage 39
TurnCounterOFF 2
END_COMMAND

(* Turn clue phone counter on. *)
COMMAND READ GRAFFITI
BeforeCommand
TurnCounterOFF 2
TurnCounterON 3
END_COMMAND

(* Put clue phone in room. *)
COMMAND ANY
AfterCommand
FlagOFF 3
CounterEquals 3 15
PrintMessage 40
PutInCurrentRoom 228
TurnCounterOFF 3
END_COMMAND

(* Answer the phone. *)
COMMAND ANSWER PHONE
BeforeCommand
IsCarrying 228
 OR
InRoom 228
PrintMessage 38
Destroy 228
DoneWithTurn
END_COMMAND

(* Tell player to talk to bear. *)
COMMAND ANY
AfterCommand
FlagOFF 3
CounterGT 1 15
PrintMessage 37
TurnCounterOFF 1
END_COMMAND

(* Make player's bladder explode. *)
COMMAND ANY
BeforeCommand
FlagOFF 1
FlagOFF 3
Chance 1
Chance 85
PrintMessage 30
Destroy 300
TurnFlagON 3
EndGame
DoneWithTurn
QuitAllCMDs
END_COMMAND

(* Make need to piss follow player to each room *)
COMMAND ANY
AfterCommand
FlagOFF 3
FlagOFF 1 
PutInCurrentRoom 204 
END_COMMAND

(* Don't let player piss after he's already pissed once. *)
COMMAND PISS
BeforeCommand
FlagON 1
FlagOFF 3
PrintMessage 9
DoneWithTurn
END_COMMAND

(* Piss in pants. *)
COMMAND PISS IN PANTS
BeforeCommand
FlagOFF 3
PrintMessage 31
TurnFlagON 3
EndGame
DoneWithTurn
END_COMMAND

(* Don't let player piss on wall. *)
COMMAND PISS ON WALLS
BeforeCommand
FlagOFF 3
PrintMessage 33
DoneWithTurn
END_COMMAND

(* Piss on the bear. *)
COMMAND PISS ON BEAR
BeforeCommand
FlagOFF 3
InRoom 300
OR
InRoom 301
PrintMessage 32
Destroy 300
TurnFlagON 3
EndGame
DoneWithTurn
QuitAllCMDs
TurnFlagON 3
END_COMMAND

(* Don't let player piss on floor. *)
COMMAND PISS ON FLOOR
BeforeCommand
FlagOFF 3
PrintMessage 18
DoneWithTurn
END_COMMAND

(* Don't let player piss in any room other than purple room. *)
COMMAND PISS
BeforeCommand
FlagOFF 3
NOT AtLocation 4
PrintMessage 1
DoneWithTurn
END_COMMAND

(* Dont let player piss if toilet is locked. *)
COMMAND PISS
BeforeCommand
AtLocation 4
IsLocked 201
PrintMessage 2
DoneWithTurn
END_COMMAND

(* Allow player to piss if in purple room with toilet unlocked. *)
(* First change the picture to the pissed-on picture if it's in the toilet. *)
COMMAND PISS
BeforeCommand
AtLocation 4
NOT IsLocked 202
NOT FlagON 1
InRoom 221
NOT IsCarrying 221
SwapLocations 221 222
END_COMMAND

(* Then let the player piss. *)
COMMAND PISS
BeforeCommand
AtLocation 4
NOT IsLocked 202
NOT FlagON 1
PrintMessage 3
PlusScore 1
TurnFlagON 1
TurnCounterON 1
Destroy 204
PutInCurrentRoom 215
DoneWithTurn
END_COMMAND

(* Sandwich smells delicious. *)
COMMAND SMELL SANDWICH
BeforeCommand
FlagOFF 3
InRoom 225
 OR
IsCarrying 225
PrintMessage 35
DoneWithTurn
END_COMMAND

(* Everything else stinks. *)
COMMAND SMELL ANY
BeforeCommand
FlagOFF 3
NOUNPresent
PrintMessage 34
DoneWithTurn
END_COMMAND

(* Eat sandwich. *)
COMMAND EAT SANDWICH
BeforeCommand
FlagOFF 3
IsCarrying 225
PrintMessage 24
Destroy 225
DoneWithTurn
END_COMMAND

(* Can't eat sandwich if you aren't carrying it. *)
COMMAND EAT SANDWICH
BeforeCommand
InRoom 225
NOT IsCarrying 225
PrintMessage 25     (* Might want to pick it up first. *)
DoneWithTurn
END_COMMAND

(* Randomly remind player that he has to piss *)
COMMAND ANY
AfterCommand
FlagOFF 3
FlagOFF 1
Chance 35
RandomMessage 11 14
END_COMMAND

COMMAND FEED SANDWICH TO BEAR
BeforeCommand
FlagOFF 3
InRoom 300
IsCarrying 225
ReDirectTo DROP SANDWICH
END_COMMAND

(* Let bear eat sandwich. *)
COMMAND DROP SANDWICH
BeforeCommand
FlagOFF 3
InRoom 300
IsCarrying 225
PrintMessage 26
Destroy 225
SwapLocations 300 301
TurnFlagOFF 2
TurnCounterOFF 4
DoneWithTurn
QuitAllCMDs
END_COMMAND

(* Throw something at bear = attack bear with object. *)
COMMAND THROW ANY AT BEAR
ReDirectTo ATTACK BEAR WITH $NOUN$
END_COMMAND

(* Attack bear with something. *)
COMMAND ATTACK BEAR WITH ANY
BeforeCommand
FlagOFF 3
ObjectPresent
InRoom 300
 OR
InRoom 301
PrintMessage 27
Destroy 300
TurnFlagON 3
EndGame
DoneWithTurn
QuitAllCMDs
END_COMMAND

(* Can't attack bear with bare hands. *)
COMMAND ATTACK BEAR
BeforeCommand
FlagOFF 3
InRoom 300
 OR
InRoom 301
PrintMessage 36
DoneWithTurn
END_COMMAND

(* Talk to bear. *)
COMMAND TALK TO BEAR
BeforeCommand
FlagOFF 3
FlagON 1
InRoom 301
PrintMessage 28
DoneWithTurn
END_COMMAND

(* Yell at player for getting UNMOVABLE objecs. *)
COMMAND GET FLOOR
BeforeCommand
FlagOFF 3
PrintMessage 19
DoneWithTurn
END_COMMAND

(* Don't let player take walls, but don't claim there are no walls here. *)
COMMAND GET WALLS
BeforeCommand
FlagOFF 3
PrintMessage 19
DoneWithTurn
END_COMMAND

(* Prevent player from going through closed door. *)
COMMAND SOUTH
BeforeCommand
AtLocation 2
NOT IsOpen 200
PrintMessage 8
DoneWithTurn
END_COMMAND

(* Prevent player from going through hole before he's found it. *)
COMMAND EAST
BeforeCommand
AtLocation 2
NOT InRoom 214
PrintMessage 15
DoneWithTurn
END_COMMAND

(* Display message when player gets Sammy Hagar poster   *)
(* Switch visible poster for the invisible one, and give *)
(* it to the player.                                            
COMMAND GET ANY
BeforeCommand
NOUNIsNumber 209
PrintMessage 29
Destroy 209       (* Destroy invisible poster *)
GetIt 210         (* Give player visible poster *)
SendToRoom 214 2  (* Put hole in room *)
SwapLocations 207 220  (* Remove Hagar from the group of posters *)
TurnCounterOFF 2
TurnCounterOFF 3
DoneWithTurn
END_COMMAND

(* Don't let player write if he doesn't have the crayon. *)
COMMAND WRITE ANY
BeforeCommand
FlagOFF 3
NOT IsCarrying 218
PrintMessage 16
DoneWithTurn
END_COMMAND

(* Do let player write if he has the crayon. *)
COMMAND WRITE ANY
BeforeCommand
FlagOFF 3
IsCarrying 218
PrintMessage 17
DoneWithTurn
END_COMMAND

(* Display message as guitar picks are picked up. *)
COMMAND GET PICKS
BeforeCommand
AtLocation 2
Present 203
NOT IsCarrying 203
PrintMessage 4
END_COMMAND

(* Display message when toilet is unlocked. *)
COMMAND UNLOCK TOILET WITH KEY
BeforeCommand
AtLocation 4
IsCarrying 202
PrintMessage 5
PutInCurrentRoom 221
PlusScore 1
END_COMMAND

(* Prevent player from re-locking toilet.  Else he can keep *)
(* locking and unlocking it to rack up points.              *)
COMMAND LOCK TOILET WITH KEY
BeforeCommand
AtLocation 4
IsCarrying 202
NOT IsLocked 201
PrintMessage 10
Destroy 202
DoneWithTurn
END_COMMAND

(* Get picture. *)
COMMAND GET PICTURE
BeforeCommand
InRoom 221
NOT IsCarrying 221
PrintMessage 20
MinusScore 1
END_COMMAND

(* Get soiled picture. *)
COMMAND GET PICTURE
BeforeCommand
InRoom 222
NOT IsCarrying 222
PrintMessage 23
MinusScore 2
END_COMMAND

(* Can't drop picture. *)
COMMAND DROP PICTURE
BeforeCommand
IsCarrying 221
 OR
IsCarrying 222
PrintMessage 21
DoneWithTurn
END_COMMAND

(* Tear picture. *)
COMMAND TEAR PICTURE
BeforeCommand
IsCarrying 221
PrintMessage 22
SwapLocations 221 223
PlusScore 2
DoneWithTurn
END_COMMAND

(* Tear soiled picture. *)
COMMAND TEAR PICTURE
BeforeCommand
IsCarrying 222
PrintMessage 22
SwapLocations 222 223
PlusScore 2
DoneWithTurn
END_COMMAND

(* Display message when toilet flushes but player hasn't pissed yet. *)
COMMAND FLUSH TOILET
BeforeCommand
AtLocation 4
FlagOFF 1
PrintMessage 6
DoneWithTurn
END_COMMAND

(* Display message when player flushes toilet after having pissed in it. *)
(* Player wins game. *)
COMMAND FLUSH TOILET
BeforeCommand
AtLocation 4
FlagON 1
PrintMessage 7
PlusScore 1
WinGame
DoneWithTurn
END_COMMAND

(* Shit. *)
COMMAND SHIT
BeforeCommand
PrintMessage 47
DoneWithTurn
END_COMMAND
